<template>
	<view>
		<top-info></top-info>
		<view class="uni-tab-bar">
			
			<scroll-list-head :tabsList="tabs" :startFlex="true" :currentTab="currentTab" @changeTab="selectTab"></scroll-list-head>

			<swiper class="swiper-box" @change="selectSwiper" :current="currentTab">
				<swiper-item>
					<scroll-view scroll-y class="list">
						<account-info></account-info>			
					</scroll-view>
				</swiper-item>
				<swiper-item>
					<scroll-view scroll-y class="list">
						<moment v-for="(item,index) in momentList.list" :moment="item.moment" :key="index"></moment>	
					</scroll-view>
				</swiper-item>
				<swiper-item>
					<scroll-view scroll-y class="list">
						<moment v-for="(item,index) in momentList.list" :moment="item.moment" :key="index"></moment>			
					</scroll-view>
				</swiper-item>
				<!-- <swiper-item v-for="(switem,idx) in momentList" :key="idx">
					<template v-if="switem.moments.length !== 0">
					<scroll-view scroll-y class="list" @scrolltolower="loadMore(idx)">
						<moment v-for="(item,index) in switem.moments" :moment="item" :key="index"></moment>
						<load-more :text="switem.loadtext"/>
					</scroll-view>
					</template>
					<template v-else>
						<no-msg></no-msg>
					</template>
				</swiper-item> -->
			</swiper>
			
		</view>
	</view>
</template>

<script>
	import TopInfo from "../../components/home-page/top-info.vue"
	import AccountInfo from "../../components/home-page/account-info.vue"
	
	import scrollListHead from "../../components/scroll-list/scroll-list-head.vue"
	
	import loadMore from "../../components/loadmore.vue"
	import NoMsg from "../../components/nomsg.vue"
	
	import Moment from "../../components/common/moment.vue"
	import MomentData from '../../common/mock/momentdata.js'
	
	export default {
		data() {
			return {
				currentTab: 0,
				tabs: ["主页","糗事","动态"],
				momentList: {
					list: MomentData.list
				}
			}
		},
		methods: {
			selectTab(index){
				this.currentTab = index
			},
			selectSwiper(e){
				// console.log(this.currentTab)
				this.currentTab = e.detail.current
			},
			
		},
		components:{
			TopInfo,
			scrollListHead,
			NoMsg,
			loadMore,
			AccountInfo,
			Moment
		}
	}
</script>

<style scoped>
	.uni-tab-bar {
		height: 600rpx;
	}
</style>
